home *** CD-ROM | disk | FTP | other *** search
/ Dynamic HTML Construction Kit / Dynamic HTML Construction Kit.iso / earthlink / nscomm / java40.jar / java / util / TimeZone.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-11-03  |  3.2 KB  |  115 lines

  1. package java.util;
  2.  
  3. import java.io.Serializable;
  4.  
  5. public abstract class TimeZone implements Serializable, Cloneable {
  6.    // $FF: renamed from: ID java.lang.String
  7.    private String field_0;
  8.    private static TimeZone defaultZone = null;
  9.    private static final int millisPerHour = 3600000;
  10.    private static final SimpleTimeZone[] timeZoneData = new SimpleTimeZone[]{new SimpleTimeZone(0, "GMT", 2, -1, 1, 7200000, 9, 4, 1, 7200000), new SimpleTimeZone(3600000, "ECT", 2, -1, 1, 7200000, 8, -1, 1, 7200000), new SimpleTimeZone(7200000, "EET", 2, -1, 1, 7200000, 8, -1, 1, 7200000), new SimpleTimeZone(7200000, "ART", 4, 1, 1, 7200000, 9, 1, 1, 7200000), new SimpleTimeZone(10800000, "EAT"), new SimpleTimeZone(Integer.MIN_VALUE, "MET"), new SimpleTimeZone(14400000, "NET"), new SimpleTimeZone(18000000, "PLT"), new SimpleTimeZone(Integer.MIN_VALUE, "IST"), new SimpleTimeZone(21600000, "BST"), new SimpleTimeZone(25200000, "VST"), new SimpleTimeZone(28800000, "CTT"), new SimpleTimeZone(32400000, "JST"), new SimpleTimeZone(Integer.MIN_VALUE, "ACT", 3, 1, 1, 7200000, 9, -1, 1, 7200000), new SimpleTimeZone(36000000, "AET", 3, 1, 1, 7200000, 9, -1, 1, 7200000), new SimpleTimeZone(39600000, "SST"), new SimpleTimeZone(43200000, "NST", 3, 1, 1, 7200000, 9, -1, 1, 7200000), new SimpleTimeZone(-39600000, "MIT"), new SimpleTimeZone(-36000000, "HST", 3, 1, 1, 7200000, 9, -1, 1, 7200000), new SimpleTimeZone(-32400000, "AST", 3, 1, 1, 7200000, 9, -1, 1, 7200000), new SimpleTimeZone(-28800000, "PST", 3, 1, 1, 7200000, 9, -1, 1, 7200000), new SimpleTimeZone(-25200000, "PNT"), new SimpleTimeZone(-25200000, "MST", 3, 1, 1, 7200000, 9, -1, 1, 7200000), new SimpleTimeZone(-21600000, "CST", 3, 1, 1, 7200000, 9, -1, 1, 7200000), new SimpleTimeZone(-18000000, "EST", 3, 1, 1, 7200000, 9, -1, 1, 7200000), new SimpleTimeZone(-18000000, "IET"), new SimpleTimeZone(-14400000, "PRT"), new SimpleTimeZone(Integer.MIN_VALUE, "CNT", 3, 1, 1, 7200000, 9, -1, 1, 7200000), new SimpleTimeZone(-10800000, "AGT"), new SimpleTimeZone(-10800000, "BET", 3, 1, 1, 7200000, 9, -1, 1, 7200000), new SimpleTimeZone(-3600000, "CAT")};
  11.    private static Hashtable lookup;
  12.  
  13.    public abstract int getOffset(int var1, int var2, int var3, int var4, int var5, int var6);
  14.  
  15.    public abstract void setRawOffset(int var1);
  16.  
  17.    public abstract int getRawOffset();
  18.  
  19.    public String getID() {
  20.       return this.field_0;
  21.    }
  22.  
  23.    public void setID(String var1) {
  24.       this.field_0 = var1;
  25.    }
  26.  
  27.    public abstract boolean useDaylightTime();
  28.  
  29.    public abstract boolean inDaylightTime(Date var1);
  30.  
  31.    public static synchronized TimeZone getTimeZone(String var0) {
  32.       try {
  33.          return (SimpleTimeZone)lookup.get(var0);
  34.       } catch (MissingResourceException var1) {
  35.          return new SimpleTimeZone(-28800000, "PST", 3, 1, 1, 7200000, 9, -1, 1, 7200000);
  36.       }
  37.    }
  38.  
  39.    public static synchronized String[] getAvailableIDs(int var0) {
  40.       String[] var1 = new String[10];
  41.       int var2 = 0;
  42.  
  43.       for(int var3 = 0; var3 < timeZoneData.length; ++var3) {
  44.          if (var0 == timeZoneData[var3].getRawOffset()) {
  45.             var1[var2++] = timeZoneData[var3].getID();
  46.          }
  47.       }
  48.  
  49.       String[] var4 = new String[var2];
  50.       System.arraycopy(var1, 0, var4, 0, var2);
  51.       return var4;
  52.    }
  53.  
  54.    public static synchronized String[] getAvailableIDs() {
  55.       String[] var0 = new String[40];
  56.       int var1 = 0;
  57.  
  58.       for(int var2 = 0; var2 < timeZoneData.length; ++var2) {
  59.          var0[var1++] = timeZoneData[var2].getID();
  60.       }
  61.  
  62.       String[] var3 = new String[var1];
  63.       System.arraycopy(var0, 0, var3, 0, var1);
  64.       return var3;
  65.    }
  66.  
  67.    public static synchronized TimeZone getDefault() {
  68.       if (defaultZone == null) {
  69.          String var0 = System.getProperty("user.timezone", "GMT");
  70.          if (var0 != null) {
  71.             defaultZone = getTimeZone(var0);
  72.             if (defaultZone != null) {
  73.                return defaultZone;
  74.             }
  75.          }
  76.  
  77.          String[] var1 = getAvailableIDs(-28800000);
  78.          if (var1 != null) {
  79.             defaultZone = getTimeZone(var1[0]);
  80.          }
  81.  
  82.          if (defaultZone == null) {
  83.             defaultZone = getTimeZone("PST");
  84.          }
  85.  
  86.          return defaultZone;
  87.       } else {
  88.          return defaultZone;
  89.       }
  90.    }
  91.  
  92.    public static synchronized void setDefault(TimeZone var0) {
  93.       defaultZone = var0;
  94.    }
  95.  
  96.    public Object clone() {
  97.       try {
  98.          TimeZone var1 = (TimeZone)super.clone();
  99.          var1.field_0 = this.field_0;
  100.          return var1;
  101.       } catch (CloneNotSupportedException var2) {
  102.          throw new InternalError();
  103.       }
  104.    }
  105.  
  106.    static {
  107.       lookup = new Hashtable(timeZoneData.length);
  108.  
  109.       for(int var0 = 0; var0 < timeZoneData.length; ++var0) {
  110.          lookup.put(timeZoneData[var0].getID(), timeZoneData[var0]);
  111.       }
  112.  
  113.    }
  114. }
  115.